﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace LWH.XmlHandler
{
    /// <summary>
    /// 直接将业务内容通过委托定义，免去为每个节点定义一个类的懒人实现
    /// </summary>
    public class SimpleElementHandler : AbstractElementHandler
    {
        Action<Dictionary<string, object>, XmlNode> mDidGetElementEvent;

        public SimpleElementHandler(string elementName,Action<Dictionary<string, object>, XmlNode> didGetElement) : base(elementName)
        {
            mDidGetElementEvent = didGetElement;
        }

        protected override void DidGetElement(Dictionary<string, object> context, XmlNode currentElement)
        {
            if(mDidGetElementEvent != null)
            {
                mDidGetElementEvent(context, currentElement);
            }
            
        }
    }
}
